from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
from sqlalchemy import DateTime, String
from datetime import datetime
from typing import Optional


class Base(DeclarativeBase):
    """SQLAlchemy声明式基类"""
    pass


class TimestampMixin:
    """时间戳混入类，提供创建时间和更新时间字段"""
    
    # created_at: Mapped[Optional[datetime]] = mapped_column(
    #     DateTime, 
    #     default=datetime.now, 
    #     comment="创建时间"
    # )
    
    # updated_at: Mapped[Optional[datetime]] = mapped_column(
    #     DateTime, 
    #     default=datetime.now, 
    #     onupdate=datetime.now, 
    #     comment="更新时间"
    # )
    
    # created_by: Mapped[Optional[str]] = mapped_column(
    #     String(50), 
    #     comment="创建人"
    # )
    
    # updated_by: Mapped[Optional[str]] = mapped_column(
    #     String(50), 
    #     comment="更新人"
    # )
    pass